# builder golang 1.16.4
ARG repo
FROM ${repo}/builder:alpine

# golang sdk
ENV GOPROXY=https://goproxy.io,https://goproxy.cn,https://mirrors.aliyun.com/goproxy/,direct
RUN apk --no-cache add binutils gcc musl-dev && \
    curl -SsL https://golang.google.cn/dl/$(curl -sSL "https://golang.google.cn/dl/?mode=json" | grep -Eo "go1.[0-9\.]+.linux-amd64.tar.gz" | head -n 1) | tar -z -x -C /usr/local/ && \
    echo 'export PATH=$PATH:/go/bin:/usr/local/go/bin' > /etc/profile.d/go.sh && chmod +x /etc/profile.d/go.sh && \
    ln -s /usr/local/go/bin/go /usr/local/bin/go && ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
